package exception02;

public class Person {
    private int age;

    public Person(int age) throws AgeException{
        if(age<0){
            throw new AgeException("年龄不能为"+age);
        }
        this.age = age;
    }

    public int getAge() {return age;}
    public void setAge(int age) throws AgeException{
        if(age<0){
            throw new AgeException();
        }
        this.age = age;}
}
